package com.zlp.alipay.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zlp.alipay.mapper.PayMapper;
import com.zlp.alipay.model.Pay;
import com.zlp.alipay.service.PayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 支付流水表 服务实现类
 * </p>
 *
 * @author ZouLiPing
 * @since 2021-11-04
 */
@Service
@Slf4j(topic = "PayServiceImpl")
public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements PayService {

    @Override
    public Pay getByOrderNo(String orderNo) {

        log.info("getByOrderNo.req orderNo={}",orderNo);
        LambdaQueryWrapper<Pay> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Pay::getOrderSn,orderNo).last(" limit 1");
        Pay pay = this.getOne(queryWrapper);
        return pay;
    }
}
